﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace DataPagination
{
/// <summary>
/// 分页_普通样式
/// </summary>
public class SplitType_Common : PDataPage
{
    public SplitType_Common()
    {
        HtmlTemplate = @"
共<span style='color:Red;'>{0}</span>条记录&nbsp;
共<span style='color:Red;'>{1}</span>页&nbsp;
<span style='{2}'><a href={3}><img src='../UIControls/images/first_page.gif' alt='首页' style='border-width:0px;'/></a>&nbsp;</span>
<span style='{4}'><a href={5}><img src='../UIControls/images/pre_page.gif' alt='上一页' style='border-width:0px;'/></a>&nbsp;</span>
第<span style='color:Red;'>{6}</span>页&nbsp;
<span style='{7}'><a href={8}><img src='../UIControls/images/next_page.gif' alt='下一页' style='border-width:0px;'/></a>&nbsp;</span>
<span style='{9}'><a href={10}><img src='../UIControls/images/last_page.gif' alt='尾页' style='border-width:0px;'/></a>&nbsp;</span>
<input type='text' id='txt_page' maxlength='3' style='width:30px;'class='input'/>
<a href='#' onclick='this.href = {11} + txt_page.value;'>转到</a>
";
    }    

    #region 需要重写的方法
    public override string GetSchema()
    {
        //运算好相关信息
        OperationInfo();
        return string.Format(HtmlTemplate,
            DataSourceCount,    //{0}
            PageCount,          //{1}
            GetDisplay(IsFirstPage), //{2}
            GetUrl_PageIndex(1),    //{3}
            GetDisplay(IsFirstPage), //{4}
            GetUrl_PageIndex(CurrentPageIndex - 1),    //{5}
            CurrentPageIndex,   //{6}
            GetDisplay(IsLastPage), //{7}
            GetUrl_PageIndex(CurrentPageIndex + 1),    //{8}
            GetDisplay(IsLastPage), //{9}
            GetUrl_PageIndex(PageCount),    //{10}
            GetUrl_PageIndex("")        //{11}
            );        
    }
    #endregion
}
}